import request from '@/utils/request'

// 案件登记
export function getCases(params) {
  return request({
    url: '/case/case/',
    method: 'GET',
    params
  })
}

export function addCase(caseInfo) {
  return request({
    url: '/case/case/',
    method: 'POST',
    data: caseInfo
  })
}

export function updateCase(caseInfo) {
  return request({
    url: `/case/case/${caseInfo.id}/`,
    method: 'PATCH',
    data: caseInfo
  })
}

export function delCase(case_id) {
  return request({
    url: `/case/case/${case_id}/`,
    method: 'DELETE',
  })
}

export function getAllCases(params) {
  return request({
    url: '/case/case_list/',
    method: 'GET',
    params
  })
}

export function getSearchCases(params) {
  return request({
    url: '/case/case_search/',
    method: 'GET',
    params
  })
}

// 律所函
export function getLetters(params) {
  return request({
    url: '/case/letter/',
    method: 'GET',
    params
  })
}

export function getLetterById(letter_id) {
  return request({
    url: `/case/letter/${letter_id}/`,
    method: 'GET'
  })
}

export function addLetter(letterInfo) {
  return request({
    url: '/case/letter/',
    method: 'POST',
    data: letterInfo
  })
}

export function updateLetter(letterInfo) {
  return request({
    url: `/case/letter/${letterInfo.id}/`,
    method: 'PATCH',
    data: letterInfo
  })
}

export function delLetter(letter_id) {
  return request({
    url: `/case/letter/${letter_id}/`,
    method: 'DELETE',
  })
}

// 律所函确认
export function getStampLetters(params) {
  return request({
    url: '/case/letter_stamp/',
    method: 'GET',
    params
  })
}

// export function addStampLetter(letterInfo) {
//   return request({
//     url: '/case/letter_stamp/',
//     method: 'POST',
//     data: letterInfo
//   })
// }

export function updateStampLetter(letterInfo) {
  return request({
    url: `/case/letter_stamp/${letterInfo.id}/`,
    method: 'PATCH',
    data: letterInfo
  })
}

// export function delStampLetter(letter_id) {
//   return request({
//     url: `/case/letter_stamp/${letter_id}/`,
//     method: 'DELETE',
//   })
// }

export function getIntroduces(params) {
  return request({
    url: '/case/introduce/',
    method: 'GET',
    params
  })
}

export function getIntroduceById(intro_id) {
  return request({
    url: `/case/introduce/${intro_id}/`,
    method: 'GET'
  })
}

export function addIntroduce(introInfo) {
  return request({
    url: '/case/introduce/',
    method: 'POST',
    data: introInfo
  })
}

export function updateIntroduce(introInfo) {
  return request({
    url: `/case/introduce/${introInfo.id}/`,
    method: 'PATCH',
    data: introInfo
  })
}

export function delIntroduce(intro_id) {
  return request({
    url: `/case/introduce/${intro_id}/`,
    method: 'DELETE',
  })
}

// 介绍信确认
export function getStampIntroduces(params) {
  return request({
    url: '/case/intro_stamp/',
    method: 'GET',
    params
  })
}


export function updateStampIntroduce(introInfo) {
  return request({
    url: `/case/intro_stamp/${introInfo.id}/`,
    method: 'PATCH',
    data: introInfo
  })
}

// 案件进度配置列表
export function getProgressList(params) {
  return request({
    url: '/case/progress_tree/',
    method: 'GET',
    params
  })
}


export function addProgress(progInfo) {
  return request({
    url: '/case/progress/',
    method: 'POST',
    data: progInfo
  })
}

export function updateProgress(progInfo) {
  return request({
    url: `/case/progress/${progInfo.id}/`,
    method: 'PATCH',
    data: progInfo
  })
}

export function updateBatchProgress(data) {
  return request({
    url: `/case/progress/batch_update/`,
    method: 'PATCH',
    data
  })
}

export function delProgress(prog_id) {
  return request({
    url: `/case/progress/${prog_id}/`,
    method: 'DELETE',
  })
}

export function getParentProgressList(params) {
  return request({
    url: '/case/parent_progress/',
    method: 'GET',
    params
  })
}

// 案件进度
export function getCaseProgList(params) {
  return request({
    url: '/case/case_progress/',
    method: 'GET',
    params
  })
}

export function addCaseProgress(caseProgInfo) {
  return request({
    url: '/case/case_progress/',
    method: 'POST',
    data: caseProgInfo
  })
}

export function updateCaseProgress(caseProgInfo) {
  return request({
    url: `/case/case_progress/${caseProgInfo.id}/`,
    method: 'PATCH',
    data: caseProgInfo
  })
}

export function delCaseProgress(caseprog_id) {
  return request({
    url: `/case/case_progress/${caseprog_id}/`,
    method: 'DELETE',
  })
}

// 案由
export function getReasonList(params) {
  return request({
    url: '/case/reason/',
    method: 'GET',
    params
  })
}

export function addReason(reasonInfo) {
  return request({
    url: '/case/reason/',
    method: 'POST',
    data: reasonInfo
  })
}

export function updateReason(reasonInfo) {
  return request({
    url: `/case/reason/${reasonInfo.id}/`,
    method: 'PATCH',
    data: reasonInfo
  })
}

export function delReason(reason_id) {
  return request({
    url: `/case/reason/${reason_id}/`,
    method: 'DELETE',
  })
}

export function getAllReason() {
  return request({
    url: `/case/reason_list/`,
    method: 'GET',
  })
}
// 刑事介绍信
export function getCrimiIntroduces(params) {
  return request({
    url: '/case/criminal_introduce/',
    method: 'GET',
    params
  })
}

export function addCrimiIntroduce(introInfo) {
  return request({
    url: '/case/criminal_introduce/',
    method: 'POST',
    data: introInfo
  })
}

export function updateCrimiIntroduce(introInfo) {
  return request({
    url: `/case/criminal_introduce/${introInfo.id}/`,
    method: 'PATCH',
    data: introInfo
  })
}

export function delCrimiIntroduce(intro_id) {
  return request({
    url: `/case/criminal_introduce/${intro_id}/`,
    method: 'DELETE',
  })
}

export function getCrimiIntroduceById(intro_id) {
  return request({
    url: `/case/criminal_introduce/${intro_id}/`,
    method: 'GET'
  })
}
//案件资料
export function getCaseFiles(params) {
  return request({
    url: '/case/file/',
    method: 'GET',
    params
  })
}

export function addCaseFile(fileInfo) {
  return request({
    url: '/case/file/',
    method: 'POST',
    data: fileInfo
  })
}

export function updateCaseFile(fileInfo) {
  return request({
    url: `/case/file/${fileInfo.id}/`,
    method: 'PATCH',
    data: fileInfo
  })
}

export function delCaseFile(file_id) {
  return request({
    url: `/case/file/${file_id}/`,
    method: 'DELETE',
  })
}

// 独立会见介绍信确认
export function getCrimStampIntros(params) {
  return request({
    url: '/case/crim_intro_stamp/',
    method: 'GET',
    params
  })
}


export function updateCrimStampIntro(introInfo) {
  return request({
    url: `/case/crim_intro_stamp/${introInfo.id}/`,
    method: 'PATCH',
    data: introInfo
  })
}